<template>
  <div :class="isSubPage ? '' : 'app-container'">
    <!-- 查询 -->
    <tl-list-search ref="search" :query-param="queryParam" @search="doQuery" :isDisplayDefaultSearch="false" v-if="isHeaderDisplay">
      <template slot="search">
        <el-form-item prop="qry_meetID" v-if="!isSubPage">所属会议
          <el-input v-model="queryParam.qry_dispmeetID" :disabled="true" class="tl-ref-selector" style="width:200px">
            <el-button slot="append" type="primary" icon="el-icon-search" @click="openMeetManageRefDialog"></el-button>
          </el-input>
        </el-form-item>
        <el-form-item prop="qry_title">任务主题
          <el-input v-model="queryParam.qry_title" placeholder="请输入任务主题" style="padding-left:5px"></el-input>
        </el-form-item>
      </template>
    </tl-list-search>
    <div>
      <!-- 列表选择 -->
      <div class="table-alert-div" ref="selector">
        <el-alert type="success" :closable="false" class="tl-table-alert-info" effect="light">
          <template slot="title">
            已选择&nbsp;<a class="tl-table-alert-info-a1">{{ selectedRowKeys.length }}</a
            >项&nbsp;&nbsp;
            <a class="tl-table-alert-info-a2" @click="doClearSelected">全部清空</a>
          </template>
        </el-alert>
      </div>
      <!--表格渲染-->
      <el-table class="tl-table" ref="mainTable" :height="isSubPage ? '300px' : tableHeight" resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <el-table-column type="index" label="序号" width="55px" align="center" header-align="center"></el-table-column>
        <el-table-column prop="taskmaintitle" label="任务主题" min-width="150px" sortable="custom" sort-by="taskmaintitle" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="enddate" label="截止日期" width="170px" sortable="custom" sort-by="enddate" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"></el-table-column>
        <!-- <el-table-column prop="initiatorname" label="发起人姓名" width="150px" sortable="custom" sort-by="initiatorname" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column> -->
        <el-table-column prop="handleusername" label="责任人姓名" width="150px" sortable="custom" sort-by="handleusername" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="relegationdeptname" label="归属信息部门" width="200px" sortable="custom" sort-by="relegationdeptname" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="failedtimes" label="失败次数" width="150px" sortable="custom" sort-by="failedtimes" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column label="操作" width="110px" v-slot="scope" fixed="right">
          <el-dropdown trigger="hover">
            <el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
            <el-dropdown-menu>
              <el-dropdown-item icon="el-icon-view" @click.native="openViewDialog('editForm', scope.row.id)">查看</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-table-column>
        <!-- <el-table-column label="操作" width="220px" v-slot="scope" fixed="right">
          <el-button type="text" icon="el-icon-edit" @click="openEditDialog('editForm', scope.row.id)">编辑</el-button>
          <el-button type="text" icon="el-icon-delete" @click="doDelete(scope.row.id)">删除</el-button>
          <el-dropdown trigger="hover">
            <el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
            <el-dropdown-menu>
              <el-dropdown-item icon="el-icon-view" @click.native="openViewDialog('editForm', scope.row.id)">查看</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-table-column> -->
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
      </el-row>
      <tl-edit ref="editForm" @refresh="doRefresh"></tl-edit>
      <tl-ref-meet-manage ref="meetManageRef" :singleSelect="true" @confirm="getMeetManageRefData"></tl-ref-meet-manage>
    </div>
  </div>
</template>

<script>
/** mixins */
import { mixin_list } from "@tapui/mixins/mixin_list"
/** 子组件 */
import tlEdit from "./edit"
import tlRefMeetManage from "../meetManage/refList"
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from "@tapui/utils/http"
export default {
  name: "meetTaskDetail",
  mixins: [mixin_list],
  components: { tlEdit, tlRefMeetManage },
  data() {
    return {
      description: "任务明细表-列表查询",
      urlPrefix: "/meet/taskDetail/",
      url: {
        // queryCodeList: '/meet/taskDetail/dataCodeList'
      },
      // 排序参数
      sorterInfo: {
        sidx: "createon",
        sord: "desc"
      },
      rowDbClickActionType: "view",
      isQueryOnCreated: false
    }
  },
  props: {
    isSubPage: {
      type: Boolean,
      default: false
    },
    sourceType: {
      type: String,
      default: "meetCreate"
    },
    sourceMeetID: {
      type: [Number, String],
      default: ""
    }
  },
  methods: {
    /** 加载数据之前 */
    beforeLoadData() {
      if (this.isSubPage) {
        this.queryParam.qry_meetID = this.sourceMeetID
      } else {
        if (!this.queryParam.qry_meetID) {
          this.$tap.alert("请选择所属会议", "warning")
          return false
        }
      }
      this.queryParam = {
        ...this.queryParam,
        sourceType: this.sourceType
      }
      return true
    },
    /** 打开会议管理参照 */
    openMeetManageRefDialog() {
      this.$refs.meetManageRef.visible = true
    },
    /** 获取会议管理参数数据 */
    getMeetManageRefData(selectionRow, selectKey, selectionValue) {
      this.$set(this.queryParam, "qry_meetID", selectionRow.id)
      this.$set(this.queryParam, "qry_dispmeetID", selectionRow.name)
    }
  }
}
</script>

<style scoped></style>
